package com.ruoyi.coupon.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.coupon.domain.CouponRecord;
import com.ruoyi.coupon.domain.JsonData;
import com.ruoyi.coupon.model.CouponRecordDO;
import com.ruoyi.coupon.model.CouponUseVO;
import com.ruoyi.coupon.mq.CouponRecordMessage;
import com.ruoyi.coupon.request.LockCouponRecordRequest;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * couponrecordService接口
 *
 * @author 林道敬
 * @date 2025-01-02
 */
public interface ICouponRecordService extends IService<CouponRecord>
{




    /**
     * 查询couponrecord
     *
     * @param id couponrecord主键
     * @return couponrecord
     */
    public CouponRecord selectCouponRecordById(String id);

    /**
     * 查询couponrecord列表
     *
     * @param couponRecord couponrecord
     * @return couponrecord集合
     */
    public List<CouponRecord> selectCouponRecordList(CouponRecord couponRecord);

    /**
     * 新增couponrecord
     *
     * @param couponRecord couponrecord
     * @return 结果
     */
    public int insertCouponRecord(CouponRecord couponRecord);

    /**
     * 修改couponrecord
     *
     * @param couponRecord couponrecord
     * @return 结果
     */
    public int updateCouponRecord(CouponRecord couponRecord);

    /**
     * 批量删除couponrecord
     *
     * @param ids 需要删除的couponrecord主键集合
     * @return 结果
     */
    public int deleteCouponRecordByIds(String[] ids);

    /**
     * 删除couponrecord信息
     *
     * @param id couponrecord主键
     * @return 结果
     */
    public int deleteCouponRecordById(String id);

    JsonData lockCouponRecords(LockCouponRecordRequest recordRequest);


    @Transactional(rollbackFor = Exception.class,propagation = Propagation.REQUIRED)
    boolean releaseCouponRecord(CouponRecordMessage recordMessage);

    R useCoupon(CouponUseVO couponUseVO);
}
